// eslint-disable-next-line no-extend-native
Array.prototype.distinct = function <T>() {
  return Array.from(new Set(this as T[]))
}

// eslint-disable-next-line no-extend-native
Array.prototype.children = function <T>() {
  return this.flatMap(item => item.children as T[] ? item.children.flatten() : item)
}
